package com.scalpel.web.util;


import javax.servlet.http.HttpServletResponse;
import java.io.PrintWriter;


/**
 * 
 * HttpServletResponse 输出工具类
 *
 * @author    scalpel.Wang
 * @version   2015年9月24日
 */
public class ResponseUtil {
	

	/**
	 * 向客户端输出数据
	 * @param response
	 * @param str
	 * @param type
	 */
	public static void printl(HttpServletResponse response, String str, String type){
		try{
			response.setCharacterEncoding("utf-8");
			response.setContentType("text/"+type);
			PrintWriter out=response.getWriter();
			str=str.replace("\\", "");
			str=str.replaceAll("	", "");
			str=str.replaceAll("\r", "");
			str=str.replaceAll("\n", "");
			out.write(str);
			out.flush();
			out.close();
		}catch(Exception e){
			e.printStackTrace();
			System.out.println("ResponseUtil.printl 出错");
		}
	}

	

}
